<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="product" tagdir="/WEB-INF/tags/product"%>

<form class="mainForm" name="productListForm" method="post" id="productListForm" action="${ctxPath}/product/product.html">
	<c:set var="editURLPath"	value="/product/prod.html?doAction=edit&from=list" scope="page" />
	<div class="top">
		<ul class="tab">
			<li class="curr"><span><fmt:message key="menu.productList"/></span></li>
		</ul>
		<%@include file="/common/pagingOnlyTop.jsp"%>
	</div>
	<div class="data" style="clear:both">		
		<c:set var="checkAll">
			<input type="checkbox" name="allbox" onclick="checkAll(this.form)"	class="checkbox" />
		</c:set>
		<c:set var="isNeedTopPaging" value="true"/>
		<table id="product" width="100%" border="0" cellspacing="0" cellpadding="0" class="list_table" style="table-layout:fixed;">	
			<tr>
			  	<th width="20"><input onclick="checkAll(this.form)" name="allbox" type="checkbox" value="" /></th>	
				<th style="width:12%">
					<span class="expand" onclick="toggleScreenAll(this)" ></span>
					<span><fmt:message key="product.imageUrl" /></span>
				</th>
				<th class='sortable ${(productSearchCriteria.orderby eq 3)?"sorted order1":((productSearchCriteria.orderby eq 4)?"sorted order2":"")}'>
					<a onclick="sortField(this,3,4)"><fmt:message key="product.productName" /></a>
				</th>
				<th style="width:15%">
					<span><fmt:message key="tags.name" /></span>
				</th>
				<th  style="width:15%" class='sortable ${(productSearchCriteria.orderby eq 1)?"sorted order1":((productSearchCriteria.orderby eq 2)?"sorted order2":"")}'>
					<a onclick="sortField(this,1,2)"><fmt:message key="productDetail.price" /></a>
				</th>
				<th  style="width:8%" class='sortable ${(productSearchCriteria.orderby eq 19)?"sorted order1":((productSearchCriteria.orderby eq 20)?"sorted order2":"")}'>
					<a onclick="sortField(this,19,20)"><fmt:message key="product.productType" /></a>
				</th>
				<th  style="width:8%" class='sortable ${(productSearchCriteria.orderby eq 21)?"sorted order1":((productSearchCriteria.orderby eq 22)?"sorted order2":"")}'>
					<a onclick="sortField(this,21,22)"><fmt:message key="product.category" /></a>
				</th>
				<th  style="width:8%" class='sortable ${(productSearchCriteria.orderby eq 23)?"sorted order1":((productSearchCriteria.orderby eq 24)?"sorted order2":"")}'>
					<a onclick="sortField(this,23,24)"><fmt:message key="product.brand" /></a>
				</th>
				<th  style="width:8%" class='sortable ${(productSearchCriteria.orderby eq 25)?"sorted order1":((productSearchCriteria.orderby eq 26)?"sorted order2":"")}'>
					<a onclick="sortField(this,25,26)"><fmt:message key="product.status" /></a>
				</th>
			</tr>
			<c:forEach var="product" items="${productList}" varStatus="status">
				<tr id="tr${product.productId}" productId="${product.productId}" class="${(status.index%2==0)?'even':'odd'}">
					<td>
						<c:if test="${productSearchCriteria.status != 3}">
							<common:htmlEscape value="${product.tagNames}" returnValue="tagNames"/>
							<common:htmlEscape value="${product.productName}" returnValue="productName"/>
							<input type="checkbox" name="multiIds" value="${product.productId}" class="checkbox" title="${productName}" tags="${tagNames}" id="multiIds_${product.productId}" />
						</c:if>
					</td>
					<td>
						<span class="expand toggleScreen" onclick="toggleScreen(this)" ></span>
						<a href="javascript:void(0)" onclick="parent.editProduct(${product.productId})">
							<product:productImage product="${product}" sizeType="s0" linkType="0" style="vertical-align:middle;" width="58px" height="58px"/>
						</a>	
					</td>
					<td>
						<b><a href="javascript:void(0)"	onclick="parent.editProduct(${product.productId})">${product.productName}</a></b>
						<c:if test="${product.productKind == 2}">
							&nbsp;【<fmt:message key="product.package"/>】 
						</c:if>
					</td>
					<td>
						<c:forEach items="${product.tagNameArray}" var="tagName">
							<common:htmlEscape value="${tagName}" returnValue="returnTagName"/>
							<b title="${returnTagName}" class="tag"><common:displayString value="${tagName}" length="5"/></b>
						</c:forEach>
					</td>
					<td>
						<product:productPrice productSku="${product.defaultProductSku}" multiple="true" hasPriceName="true"/>
					</td>
					<td>
						${product.productType.productTypeName}
					</td>
					<td>
						${product.category.categoryName}
					</td>
					<td>
						${product.brand.brandName}
					</td>
					<td>
						<fmt:message key="product.status.${product.status}"/>
					</td>
				</tr>
				<tr style="display: none;" class="${(status.index%2==0)?'even':'odd'} sub" >
				</tr>	
			</c:forEach>
			<c:if test="${empty productList}">
				<tr>
					<td colspan="9" style="text-align:center">
						<fmt:message key="productList.empty"/>
					</td>
				</tr>
			</c:if>
		</table>	
		<%@include file="/common/pagingOnly.jsp" %>
	</div>
</form>
<%--------保存查询条件 -------%>
<%@include file="productSearchCriteriaStorage.jspf"%>

<script type="text/javascript">
$j(document).ready(function () {
	highlightTableRows("product");
	//displayListButtons(${productSearchCriteria.status});
});
</script>
